package com.suneast.suneaststore;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;

import com.suneast.suneaststore.modules.launcher.LauncherScrollFragment;
import com.suneast.suneaststore.modules.launcher.ScrollLauncherTag;
import com.suneast.suneaststore.util.storage.LattePreference;

import me.yokeyword.fragmentation.SupportActivity;

public class SplashActivity extends SupportActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        if (LattePreference.getAppFlag(ScrollLauncherTag.HAS_FIRST_LAUNCHER_APP.name())) {
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
            finish();
        } else {
            setContentView(R.layout.activity_splash);
            loadRootFragment(R.id.splash_container, new LauncherScrollFragment());
        }
    }
}
